# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

_pyname=Pygments
_realname=pygments
# this is a separate package to break the pygments <-> sphinx dependency cycle
pkgbase=mingw-w64-python-${_realname}-docs
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}-docs")
pkgver=2.18.0
pkgrel=1
pkgdesc="Python syntax highlighter (mingw-w64) (documentation)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://pygments.org/"
msys2_repository_url="https://github.com/pygments/pygments"
msys2_references=(
  'purl: pkg:pypi/pygments'
  "cpe: cpe:/a:pygments:pygments"
)
license=('spdx:BSD-2-Clause')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-sphinx"
  "${MINGW_PACKAGE_PREFIX}-python-wcag-contrast-ratio"
)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199')

build () {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  make -C doc html
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc"
  cp -rT doc/_build/html "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
}
